package com.weavernorth.sysap.timer;


import com.weavernorth.sysap.checkstatus.CheckSuccessStatus;
import com.weavernorth.sysap.service.SyncOrgStrucService;
import com.weavernorth.sysap.service.SyncOrgStrucServiceImpl;
import com.weavernorth.util.Logger4jUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import weaver.interfaces.schedule.BaseCronJob;

/**
 * 同步组织架构定时任务-全量同步
 *
 * @author Zm
 * @version v1.0 created by 2019-10-09
 */
public class SyncAllOrganizationStructureTimer extends BaseCronJob {
//    private Logger log = new Logger4jUtil().getLogger("/Timmer/synchronization_log/");
    @Override
    public void execute() {
        Logger log =Logger4jUtil.getLoggerByName("/Timmer/synchronization_log/");
        SyncOrgStrucService sosService = new SyncOrgStrucServiceImpl();
        log.info("组织同步定时任务,全量同步");
        //isall为0 ,全量同步,1为增量同步
        //组织同步
        sosService.syncOrgInfo(log,"0");
        //同步岗位
        sosService.syncJobtitlesInfo(log,"0");
        //人员同步
        sosService.syncResourceInfo(log,"0");
//        同步完成后,调用检测接口,更新离职人员,封存部门
//        log.info("检查接口执行开始,更新离职人员:");
        CheckSuccessStatus checkSuccessStatus=new CheckSuccessStatus();
        checkSuccessStatus.setLog(log);
        checkSuccessStatus.checkStatus();
        log.info("检查接口执行结束:");


    }
}
